<template>
  <div style=" padding: 15px;">
    <div>
      <div style="margin-top: 15px;margin-bottom: 15px;display: flex;justify-content: center">
        <div  style="flex: 1">
          <el-input placeholder="请输入车牌号" v-model="s" class="input-with-select" style="width: 200px"> </el-input>
          <el-button type="primary" icon="el-icon-search" >查询</el-button>
        </div>
        <div>
          <el-button type="primary" icon="el-icon-plus" @click="$router.push({ path: '/information/driverEdit'})" >添加</el-button>
        </div>
      </div>
    </div>
    <UTable ref="mTable" :search-api="getOrderPage" :columns="columns" />

  </div>

</template>
<script>
  import UTable from '@/components/UTable'
  import {getOrderPage} from '@/api/order'
  export default {
    components: {
      UTable
    },
    data() {
      return {

        getOrderPage:getOrderPage,
        columns: [
          { prop: 'orderId', label: '订单编号' },
          { prop: 'shipContact', label: '联系人', width: 80 },
          { prop: 'orderType', label: '订单类型',width: 80 , formatter: function(row, colum) {
              return row.orderType === 1 ? '临时用车' : '预约用车'
            } },
          { prop: 'carOcMax', label: '车温',width: 120, formatter: function(row, colum) {
              return row.carOcMin + '度 ~' + row.carOcMax + '度'
            } },
          { prop: 'carTypeName', label: '车型',width: 100  },
          { prop: 'orderKm', label: '里程数',width: 100  },
          { type: 'RMB', prop: 'taxes', label: '税费',width: 100 },
          {  prop: 'discount', label: '折扣(%)',width: 100 },
          { type: 'RMB', prop: 'totlaPrice', label: '订单金额',width: 100 },
          { prop: 'status', label: '订单状态',width: 100, formatter: function(row, colum) {
              switch (row.status) {
                case 1:
                  return '待派遣 '
                case 2:
                  return '待取货'
                case 3:
                  return '待送达'
                case -1:
                  return '订单失败’'
              }
            } },
          { prop: 'totlaPrice', label: '支付方式',width: 100 },
          { prop: 'createtime', label: '创建时间',width:130 },
          { type: 'handle', fixed: 'right',  buttons: [
              { text: '详情', type: 'ifno' },
              { text: '通过', type: 'danger', isShow: function(row, rowIndex) { return row.status === 0 } },
              { text: '驳回', type: 'danger', isShow: function(row, rowIndex) { return row.status === 0 } }

            ]
          }
        ]
      }
    }
  }
</script>

<style scoped>

</style>
